package gameStates.gui;

import main.listeners.listenerClasses.loading.LoadingAbortedEvent;
import main.listeners.listenerClasses.loading.LoadingListener;
import main.listeners.listenerClasses.loading.LoadingStartedEvent;
import main.listeners.listenerClasses.loading.LoadingStoppedEvent;
import gameStates.absGamesStates.gui.AbsLoadingState;
import gameStates.passes.AbsPassManagerState;
import interfaces.loading.LoadingScreen;

public class LoadingState extends AbsLoadingState {
	
	protected LoadingScreen loadingScreen;
	
	public LoadingState(AbsPassManagerState passManagerState) {
		super("loading", passManagerState, true);
		
		addListenerToClearer(new LoadingListener() {
			@Override
			public void loadingStopped(LoadingStoppedEvent event) {
				setActive(false);
			}
			
			@Override
			public void loadingAborted(LoadingAbortedEvent event) {
				setActive(false);
			}
			
			@Override
			public void loadingStarted(LoadingStartedEvent event) {}
		});
	}
	
	public void updateLoadingScreen(int newValue) {
		loadingScreen.updateLoadingScreen(newValue);
	}
	
	@Override
	public void cleanup() {
		super.cleanup();
	}
}